package com.zk.service.impl;


import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

import org.apache.log4j.Logger;

import com.zk.service.HRProxyService;
import com.zk.util.DBConnection;
import com.zk.util.Request;

public class HRProxyServiceImpl implements HRProxyService {

	private static Logger logger = Logger.getLogger(HRProxyServiceImpl.class);
	public static Connection conn;    
    public static PreparedStatement ps;    
    public static ResultSet rs;    
    public static Statement st ;
    private static String url;    
    private static String user;    
    private static String password;    
    static{

    }
    public void getConnection(){  
   	 InputStream in = DBConnection.class.getClassLoader()
                .getResourceAsStream("db.properties");
   	 Properties props = new Properties();
   	 try {
			props.load(in);
			url = props.getProperty("url");
			user = props.getProperty("user");
			password = props.getProperty("password");
           Class.forName("oracle.jdbc.driver.OracleDriver");    
           conn=DriverManager.getConnection(url, user, password);    
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    } 

	@Override
	public String BPHC_HR_GETORGINFOBYID(String request) {
		Request r = new Request(request);
		
		// TODO Auto-generated method stub
		try {
			this.getConnection();
			st = conn.createStatement();
			rs = st.executeQuery("select * from azfxs");
			while (rs.next()) {    
		        System.out.println(rs.getString("YEAR"));    
		    } 
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally{
		    if(rs != null) {    
		        try { rs.close(); } catch (SQLException e) { }    
		    }    
		    if(st != null) {    
		        try { st.close(); } catch (SQLException e) { }    
		    }    
		    if(conn != null) {    
		        try { conn.close(); } catch (SQLException e) { }    
		    }
		}
		return null;
	}

	@Override
	public String BPHC_HR_ORGADD(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_ORGEDIT(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_ORGDELETE(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_ORGDELETELOGIC(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_GETUSERINFOBYID(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_GETUSERINFOBYTIME(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_GETORGINFOBYTIME(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_PERSONADD(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_PERSONDELETE(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_PERSONDELETELOGIC(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_HR_PERSONEDIT(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_OA_ATTENDANCEREPORT(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_OA_EMPLOYEEASKFORLEAVE(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_OA_EMPLOYEEDIMISSION(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_OA_EMPLOYEEREGULAR(String request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String BPHC_OA_PERSONNELCHANGE(String request) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
